Optimal. Leaf size=97 \[ a^2 (b B-a C) x+\frac {b \left (4 a b B-2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 (2 b B+a C) \tan (c+d x)}{2 d}+\frac {b^2 C (a+b \sec (c+d x)) \tan (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 46, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.109, Rules used = {4126, 4003,
3855, 3852, 8} \begin {gather*} \frac {b \left (-2 a^2 C+4 a b B+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 x (b B-a C)+\frac {b^2 (a C+2 b B) \tan (c+d x)}{2 d}+\frac {b^2 C \tan (c+d x) (a+b \sec (c+d x))}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4003
Rule 4126
Rubi steps
\begin {align*} \int (a+b \sec (c+d x)) \left (a b B-a^2 C+b^2 B \sec (c+d x)+b^2 C \sec ^2(c+d x)\right ) \, dx &=\frac {\int (a+b \sec (c+d x))^2 \left (b^2 (b B-a C)+b^3 C \sec (c+d x)\right ) \, dx}{b^2}\\ &=\frac {b^2 C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {\int \left (2 a^2 b^2 (b B-a C)+b^3 \left (4 a b B-2 a^2 C+b^2 C\right ) \sec (c+d x)+b^4 (2 b B+a C) \sec ^2(c+d x)\right ) \, dx}{2 b^2}\\ &=a^2 (b B-a C) x+\frac {b^2 C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} \left (b^2 (2 b B+a C)\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (b \left (4 a b B-2 a^2 C+b^2 C\right )\right ) \int \sec (c+d x) \, dx\\ &=a^2 (b B-a C) x+\frac {b \left (4 a b B-2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {\left (b^2 (2 b B+a C)\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=a^2 (b B-a C) x+\frac {b \left (4 a b B-2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b^2 (2 b B+a C) \tan (c+d x)}{2 d}+\frac {b^2 C (a+b \sec (c+d x)) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.61, size = 77, normalized size = 0.79 \begin {gather*} \frac {2 a^2 (b B-a C) d x+b \left (4 a b B-2 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))+b^2 (2 b B+2 a C+b C \sec (c+d x)) \tan (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.06, size = 129, normalized size = 1.33
method | result | size |
derivativedivides | \(\frac {2 a \,b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )-a^{2} b C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+b^{3} B \tan \left (d x +c \right )+C \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a^{2} b B \left (d x +c \right )-a^{3} C \left (d x +c \right )+C \,b^{2} a \tan \left (d x +c \right )}{d}\) | \(129\) |
default | \(\frac {2 a \,b^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )-a^{2} b C \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+b^{3} B \tan \left (d x +c \right )+C \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+a^{2} b B \left (d x +c \right )-a^{3} C \left (d x +c \right )+C \,b^{2} a \tan \left (d x +c \right )}{d}\) | \(129\) |
norman | \(\frac {\left (a^{2} b B -a^{3} C \right ) x +\left (-2 a^{2} b B +2 a^{3} C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (a^{2} b B -a^{3} C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {b^{2} \left (2 b B +2 a C +C b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {b^{2} \left (2 b B +2 a C -C b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {b \left (4 a b B -2 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {b \left (4 a b B -2 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(217\) |
risch | \(B \,a^{2} b x -C \,a^{3} x -\frac {i b^{2} \left (C b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 B b \,{\mathrm e}^{2 i \left (d x +c \right )}-2 C a \,{\mathrm e}^{2 i \left (d x +c \right )}-C b \,{\mathrm e}^{i \left (d x +c \right )}-2 b B -2 a C \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a \,b^{2} B}{d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} C}{d}+\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{2 d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a \,b^{2} B}{d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} C}{d}-\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{2 d}\) | \(233\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.30, size = 142, normalized size = 1.46 \begin {gather*} -\frac {4 \, {\left (d x + c\right )} C a^{3} - 4 \, {\left (d x + c\right )} B a^{2} b + C b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, C a^{2} b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) - 8 \, B a b^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) - 4 \, C a b^{2} \tan \left (d x + c\right ) - 4 \, B b^{3} \tan \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.86, size = 154, normalized size = 1.59 \begin {gather*} -\frac {4 \, {\left (C a^{3} - B a^{2} b\right )} d x \cos \left (d x + c\right )^{2} + {\left (2 \, C a^{2} b - 4 \, B a b^{2} - C b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (2 \, C a^{2} b - 4 \, B a b^{2} - C b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (C b^{3} + 2 \, {\left (C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - \int C a^{3}\, dx - \int \left (- B a^{2} b\right )\, dx - \int \left (- B b^{3} \sec ^{2}{\left (c + d x \right )}\right )\, dx - \int \left (- C b^{3} \sec ^{3}{\left (c + d x \right )}\right )\, dx - \int \left (- 2 B a b^{2} \sec {\left (c + d x \right )}\right )\, dx - \int \left (- C a b^{2} \sec ^{2}{\left (c + d x \right )}\right )\, dx - \int C a^{2} b \sec {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 213 vs.
\(2 (93) = 186\).
time = 0.50, size = 213, normalized size = 2.20 \begin {gather*} -\frac {2 \, {\left (C a^{3} - B a^{2} b\right )} {\left (d x + c\right )} + {\left (2 \, C a^{2} b - 4 \, B a b^{2} - C b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (2 \, C a^{2} b - 4 \, B a b^{2} - C b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (2 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.40, size = 221, normalized size = 2.28 \begin {gather*} \frac {\frac {B\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {C\,b^3\,\sin \left (c+d\,x\right )}{2}+\frac {C\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2}}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )}-\frac {2\,\left (C\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {C\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,1{}\mathrm {i}}{2}-B\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+B\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,2{}\mathrm {i}-C\,a^2\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,1{}\mathrm {i}\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________